<include file="Common:header" />
<body>
<table><tr>
<td width="180" valign="top"><include file="Common:adminpanel" /></td>
<td valign="top" >
<div>
<form id="form1" name="form1" method="post" action="<{:U('rechargesave')}>">
	<table width="100%" cellspacing="1" cellpadding="3" border="0">
		<tr>
			<th height="30" colspan="2" align="center">[充值/减款] - [<{$user['nick']}>]</th>
		</tr>
		<tr>
			<td width="80" height="30" align="center">款项类型</td>
			<td><select name="paytypeid" id="paytypeid">
					<option value="1">充值</option>
					<option value="3">减款</option>
			</select></td>
		</tr>
		<tr>
			<td width="80" height="30" align="center">金额</td>
			<td><input type="text" name="paymoney" id="paymoney" value="" /> </td>
		</tr>
		<tr>
			<td width="80" height="30" align="center">备注</td>
			<td><input type="text" name="paycontent" id="paycontent" value="[充值]：<{$user['nick']}>" /></td>
		</tr>
		
		<tr>
				<td height="30" align="right">&nbsp;</td>
				<td>
				<input type="hidden" name="user_id" id="user_id" value="<{$user['id']}>" />
				<input type="submit" name="button" id="button" value="提交" />
				<input type="button" name="button3" id="button3" value="返回列表" onclick="window.location.href='<{:U('slist')}>'" />
				</td>
			</tr>
			<tr>
				<td></td>
				<td height="30" colspan="2">
					<div style="font-family: 微软雅黑, Tahoma; letter-spacing: 2px; display: block;" id="result"></div>
				</td>
			</tr>
	</table>
	</form>
</div>
</td>
</tr>
</table>
<script>
	// FROM  Submit 
$(document).ready(function(){
		
	$("#paytypeid").bind( 'change', function(){
		var idv = $(this).val();
		if( '1' == idv ){
			$("#paycontent").val( '[充值]：<?=$_SESSION[seller_nick]?>' );
		}else if( '3' == idv ) {
			$("#paycontent").val( '[减款]：<?=$_SESSION[seller_nick]?>' );
		}
		
	})
});
	
	$('#form1').ajaxForm({
		beforeSubmit : checkForm, // pre-submit callback
		success : complete, // post-submit callback
		dataType : 'json'
	});
	function checkForm() {
		/*
		if( '' == $.trim($('#title').val())){
		    $('#result').html('标题不能为空').show();
		    return false;
		}
		 */
		//可以在此添加其它判断
	}
	function complete(data) {
		if (data.status == 1) {
			//$('#result').html(data.info).show().fadeOut(2000);
			window.location.href="<{:U('/Seller/payment?id='.$user['id'] )}>";
		} else {
			$('#result').html(data.info).show();
		}
	}
	
</script>
</body>
</html>
